﻿using DDDNorthWind.Core.Domain.ValueObject;

namespace DDDNorthWind.AC.Products.Domain.ValueObject
{
    public class ProductSizes : ValueObject<ProductSizes>
    {
        public ProductSizes()
        {
            
        }
        public ProductSizes(double high, double width, double lenght, double weight)
        {
            High = high;
            Width = width;
            Length = lenght;
            Weight = weight;
        }

        public virtual double High { get; private set; }
        public virtual double Width { get; private set; }
        public virtual double Length { get; private set; }

        public virtual double Weight { get; private set; }

        #region "Equals"

        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override bool Equals(ProductSizes other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return other.High.Equals(High)
                && other.Width.Equals(Width)
                && other.Length.Equals(Length)
                && other.Weight.Equals(Weight);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = High.GetHashCode();
                result = (result * 397) ^ Width.GetHashCode();
                result = (result * 397) ^ Length.GetHashCode();
                result = (result * 397) ^ Weight.GetHashCode();
                return result;
            }
        }

        public static bool operator ==(ProductSizes left, ProductSizes right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(ProductSizes left, ProductSizes right)
        {
            return !Equals(left, right);
        } 
        #endregion

        
    }
}